package com.deco.back.controller.fileupload;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.deco.back.bf.common.FileUploadBf;
import com.deco.domain.vo.common.FileUploadInfoVo;
import com.free.common.vo.ResultModel;
import com.free.exception.SystemException;

@Controller
public class FileUploadController {


	@Autowired
	FileUploadBf uploadBf;

	@RequestMapping(value = "/cms_media_upload")
	@ResponseBody
	public ResultModel uploadFile(@RequestParam MultipartFile file, FileUploadInfoVo info) throws IOException, SystemException {
		if(file.isEmpty()){
			return ResultModel.success();
		}
		return uploadBf.upload(file,info);
	}

}
